﻿@page
@model RazorPagesSample.Pages.Books.IndexModel

@{
    ViewData["Title"] = "Index";
}

<h2>Index</h2>

<p>
    <a asp-page="Create">Create New</a>
</p>
<table class="table">
    <thead>
        <tr>
                <th>
                    @Html.DisplayNameFor(model => model.Book[0].Title)
                </th>
                <th>
                    @Html.DisplayNameFor(model => model.Book[0].Publisher)
                </th>
            <th></th>
        </tr>
    </thead>
    <tbody>
@foreach (var item in Model.Book) {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.Title)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Publisher)
            </td>
            <td>
                <a asp-page="./Edit" asp-route-id="@item.BookId">Edit</a> |
                <a asp-page="./Details" asp-route-id="@item.BookId">Details</a> |
                <a asp-page="./Delete" asp-route-id="@item.BookId">Delete</a>
            </td>
        </tr>
}
    </tbody>
</table>
